package exe;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Exeffmpeg_01 {
    public static void main(String[] args) throws IOException {
        String exe = "D:\\00\\01\\demo_01\\ffmpeg-20180227-fa0c9d6-win64-static\\bin\\ffmpeg.exe";
        String srcFile = "D:\\00\\01\\demo_01\\lucene.avi";
        String destFile = "D:\\00\\01\\demo_01\\luu.mp4";
        List<String> list = new ArrayList<>();
        list.add(exe);
        list.add("-i");
        list.add(srcFile);
        list.add("-b:v");
        list.add("2000k");
        list.add("-vf");
        list.add("scale=500x500");
        list.add(destFile);
        ProcessBuilder processBuilder = new ProcessBuilder();
        processBuilder.redirectErrorStream(true);
        ProcessBuilder command = processBuilder.command(list);
        Process process = command.start();
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
        String line = null;
        while ((line = bufferedReader.readLine()) != null){
            System.out.println(line);
        }
    }
}
